Meshtree Editor version 0.1 by sapper June 2010
Download link can be found at tombraiderforums.com.

Meshtree Editor is a program that allows you to
change the meshtree structure of a moveable
object.

It cannot Add meshes or Move meshes or Replace
meshes, you need Wadmerger's Meshtree Editor
for that.

The idea is that you create your object in Wadmerger's
Meshtree Editor by adding the meshes in the same
order as your meshtree diagram (see the MeshTreeKit
in the Docs folder).

Adding the Pushes and Pops in Wadmerger's Meshtree
Editor can be frustrating due to the program crashing.
So you just chain the meshes together without any
Pops or Pushes and save the wad.

Open the wad in this Meshtree Editor and select
the moveable you created in Wadmerger. If you
added no Pops or Pushes in Wadmerger, the opCodes
will be all zero.

Change the values in the opCode column to the
values you want. Click twice on a cell to enable editing.
The opCode values can only be 0, 1, 2 or 3.
You can use the MeshTreeKit to help determine the
opCodes for each mesh.

Save the wad.

Now when you open the wad in Animation Editor
the object should have the required structure for you 
to animate.

The program will give warnings for some errors in
the meshtree structure but I do not have a complete
understanding of the rules so errors may still occur.

Note that some of Core Design's original objects
may give warnings but they still work in game.
An example found by IceBerg is MESHSWAP2 in the
karnak wad. This object doesn't cause any problems
in game because it is only used to store alternate
meshes. If you put this object in another slot it 
may cause problems.

In the Special menu you can set all the opCodes to
zero. This removes all the Pops and Pushes at once.
This is handy if you want to Move meshes in Wadmerger's
Meshtree Editor which can be buggy if you don't remove
the Pops and Pushes.

Also in the Special menu is a command to check the
meshtrees for all the moveables in a wad. The information
is printed to the console (dos) window.
Any errors are reported and for those moveables without
errors, the maximum stack depth is reported.

In the Special menu is a command to Rebuild the
Link integer list. Wadmerger inserts values between
the link integers for some moveables that have links.
These values are not present in the original wads and are
not used. It is not necessary to remove these extra values
since Wadmerger's wads have worked with TRLE for many years.
Rebuilding the link integer list may only make the size of 
your wad smaller.

You can also use this Meshtree Editor to change
the offset data for the meshes in an object. The
offset data is the position of each mesh from it's
parent mesh's pivot point for the object's "No Animation"
pose.

It is possible to change the offsets using Animation Editor
but Wadmerger's Move input boxes use units of one sector.
To move half a sector you input 0.5.
If you input 0.001 you move 1.024 TR units and this will need to
be rounded to an integer for the wad.
This Meshtree Editor displays offsets in TR units.
So to move a mesh by 1 TR unit just increase or decrease the
offset value by 1.
Note it is best to use Wadexplorer to see the positive directions
for the axes but you can experiment and see which way the mesh
moves in Animation Editor. You would use Animation Editor to 
position the meshes and just fine tune the position with this
Meshtree Editor.

The maximum and minimum offsets this program will allow are
10240 and -10240 respectively (10 sectors). 
If you have an object with an offset larger or smaller than this
do not edit them in this program. As long as you don't edit them
the data will not be changed when saving.

See the Docs folder for some tutorials.

To run Meshtree Editor, double click on meshtree_editor.exe.

Note the program requires DLL files that cannot
be distributed with the program. Hopefully they
are included in your OS.


MAKE SURE YOU HAVE BACKUP COPIES OF YOUR WAD.
Changing the meshtree or offset data will change all the animations
for an object.

If you see the words "Exception" and "Traceback" in the console (dos)
window this program has malfunctioned, so to play it safe, close it
down and restart. If the program malfunctions the wad may be corrupted
so if you save the wad use a new name.

Notes:
Program written in Python 2.5
Uses wxPython 2.8.10.1(msw-unicode).
Exe version created using py2exe.

Tested only on WindowsXP.
Tested only with version 129 wads.



